#include <bits/stdc++.h>
using namespace std;
int M[100];
int n, m;

int dfs(map<pair<int, int>, int> &mp,int l, int r)
{
    if(r <= l) return 0;
    pair<int, int> p = make_pair(l, r);
    if(mp.find(p) != mp.end()) return mp[p];          // 当前状态访问过了
    int ans = INT_MAX;                                // 获取当前最优答案
    for(int i = 0; i < m && M[i] <= r; ++i) 
    {
        if(M[i] < l) continue;    // make sure : l <= M[i] <= r
        ans = min(ans, dfs(mp, l, M[i] - 1) + dfs(mp , M[i] + 1, r));
    }
    if(ans == INT_MAX) ans = 0;
    else ans = ans + (r - l);
    return mp[p] = ans;
} 
int main()
{
#ifdef LOCAL
    freopen("ADV-299.in", "r", stdin);
#endif
    std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); 
    int T;
    cin >> T;
    while(T--)
    {
        cin >> n >> m;
        for(int i = 0; i < m; ++i) cin >> M[i];
        map<pair<int, int>, int> mp;
        cout << dfs(mp ,1, n) << endl;
    }
    return 0;
}